package com.squirrel.common.util;

import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.util.ByteSource;

/**
 * @Description PasswordUtils 密码工具类
 * @Author 关远键
 * @Version v1.0.0
 * @Date 2021/11/15 15:22
 */
@Deprecated
public class PasswordUtils {

    private static final String HASH_ALGORITHM_NAME = "MD5";
    private static final String CREDENTIALS = "!GYJ_2SECRET89(&%)yuanjianFrom2333#";
    private static final Integer HASH_ITERATIONS = 2;

    /**
     * 加密
     * @author 关远键
     * @date 2021/11/15 15:31
     * @param name
     * @param password
     * @return java.lang.String
     */
    public static String encode(String name, String password) {
        Object obj = new SimpleHash(HASH_ALGORITHM_NAME, password, ByteSource.Util.bytes(name), HASH_ITERATIONS);
        return obj.toString();
    }

}
